<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ezcomp="http://java.sun.com/jsf/composite/ezcomp">
    <ui:composition template="default_layout_with_menu.xhtml">
        <ui:define name="titulo-pagina">Dados da rodada</ui:define>
        <ui:define name="content">
            <p:panel id="panelForm" header="Dados do Rodada" >
                <p:messages />
                <h:inputHidden value="#{rodadaJSFBean.rodada.id}"/>
                <h:panelGrid columns="3">

                    <h:outputLabel value="ID:" />
                    <h:outputText value="#{rodadaJSFBean.rodada.id}"/>
                    <h:outputLabel/>

                    <h:outputLabel for="nome" value="Nome:" />
                    <h:inputText id="nome" value="#{rodadaJSFBean.rodada.nomeRodada}" label="Nome"  />
                    <p:message for="nome" id="m1" />

                    <h:outputLabel for="qrodadas" value="Quantidade Rodadas:" />
                    <h:inputText id="qrodadas" value="#{rodadaJSFBean.rodada.qtdRodada}" label="qrodadas"  />
                    <p:message for="qrodadas" id="m2" />

                    <h:panelGrid columns="2">
                        <p:commandButton value="Proceguir" action="#{rodadaJSFBean.salvaRodada}" styleClass="botaoForm" ajax="false" image="salvar"/>
                        <ezcomp:navButton label="Cancelar" pagina="#{rodadaJSFBean.paginaListagem}" image="cancelar"/>
                    </h:panelGrid>
                </h:panelGrid>
                <p:panel >
                    <p:dataTable id="tabela1"  emptyMessage="Nenhum rodada cadastrado." value="#{rodadaJSFBean.jogoBean.jogos}" var="jogo" paginator="false" rows="100">
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Cód."/>
                            </f:facet>
                            <h:outputText value="#{jogo.idJogo}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Casa"/>
                            </f:facet>
                            <h:selectOneMenu id="cat" value="#{jogo.time1}" label="Casa" converter="sec">
                                <f:selectItem itemLabel="Selecione o time da casa"/>
                                <f:selectItems value="#{rodadaJSFBean.equipes}" var="c" itemLabel="#{c}" itemValue="#{c}"/>
                            </h:selectOneMenu>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="X"/>
                            </f:facet>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Visitante"/>
                            </f:facet>
                            <h:selectOneMenu id="vi" value="#{jogo.time2}" label="Visitante" converter="sec">
                                <f:selectItem itemLabel="Selecione o time Visitante"/>
                                <f:selectItems value="#{rodadaJSFBean.equipes}" var="c" itemLabel="#{c}" itemValue="#{c}"/>
                            </h:selectOneMenu>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputLabel value="Dia" />
                            </f:facet>
                            <p:calendar id="dataConta" value="#{jogo.dataJogo}" showButtonPanel="true" mode="popup">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </p:calendar>

                        </p:column>

                    </p:dataTable>

                </p:panel>
                <h:panelGrid columns="1">
                    <p:commandButton value="Salvar" action="#{rodadaJSFBean.savaJogoRodada}" styleClass="botaoForm" ajax="false" image="salvar"/>
                </h:panelGrid>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>

